# 
# Copyright (c) 2010 Systar SA - Sylvestre Gallon <sylvestre.gallon@systar.fr>
# 
# Permission to use, copy, modify, and distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice appear in all copies.
# 
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
# 

NAME=pb4lol

all:
	@if [ ! -d build ] ; then mkdir build; fi;
	@cd build && cmake .. && make
	@cp -fr build/pb4lol bin/.

clean:
	@rm -fr build
	@rm -fr *~
	@rm -fr */*~

fclean:
	@rm -fr bin/pb4lol

re: clean all

test:
	@./bin/pb4lol

diff:
	@hg diff > trace
	@vim trace
	@rm -f trace

analyze:
	@if [ ! -d build ] ; then mkdir build; fi; 
	@cd build && cmake -DCMAKE_C_COMPILER=/usr/local/bin/ccc-analyzer .. \
       	&& scan-build -o `pwd`/../reports/ make && cd ..
	@make clean

vgrind: all
	valgrind -v --tool=memcheck --leak-check=yes --show-reachable=yes \
		--num-callers=20 --track-fds=yes ./bin/pb4lol
